set more off 
mata: mata set matafavor speed, perm

use "E:\隨身硬碟備份\E\TRY\findev_2017\Fin_Co2_pol_2020\program\n82_4y_8417_renew.dta",clear
tsset id period

egen right_a=mean(sc_right),  by(id)
tabstat right_a, stat(p10 p25 p50 p75 p90 mean)

***Table 6.Marginal effects of finance, evaluated at various values of political rights***

** Panel C: Green technology per capita-political right**

*FS aggregate*
xtabond2 lnav_techpc c.fin_dev c.fin_dev#c.sc_right c.fin_str c.fin_str#c.sc_right c.sc_right ///
c.lnav_gdp c.lnav_gdp#c.lnav_gdp ln_techpc0 ln_trad0 ln_urb0 ln_sec0 ln_inds0, ///
gmm(c.fin_dev, lag(2 4)orthogonal)     gmm(c.fin_dev#c.sc_right, lag(1 1)collapse ) ///
gmm(c.fin_str, lag(2 2))               gmm(c.fin_str#c.sc_right, lag(1 1)collapse ) ///
gmm(c.sc_right,lag(2 2) collapse) ///
gmm(c.lnav_gdp,lag(1 1)orthogonal)     gmm(c.lnav_gdp#c.lnav_gdp,lag(1 1)orthogonal) ///  
iv(ln_techpc0 ln_trad0 ln_urb0 ln_sec0 ln_inds0) ///
twostep small

margins, dydx(c.fin_dev) at(sc_right=0.0561)  
margins, dydx(c.fin_dev) at(sc_right=0.1666)  
margins, dydx(c.fin_dev) at(sc_right=0.4366)  
margins, dydx(c.fin_dev) at(sc_right=0.9444)  
margins, dydx(c.fin_dev) at(sc_right=1)  

margins, dydx(c.fin_str) at(sc_right=0.0561)  
margins, dydx(c.fin_str) at(sc_right=0.1666)  
margins, dydx(c.fin_str) at(sc_right=0.4366)  
margins, dydx(c.fin_str) at(sc_right=0.9444)  
margins, dydx(c.fin_str) at(sc_right=1)  

*boone*
xtabond2 lnav_techpc c.fin_dev c.fin_dev#c.sc_right c.av_bon c.av_bon#c.sc_right c.sc_right ///
c.lnav_gdp c.lnav_gdp#c.lnav_gdp ln_techpc0 ln_trad0 ln_urb0 ln_sec0 ln_inds0, ///
gmm(c.fin_dev,    lag(1 1)orthogonal)    gmm(c.fin_dev#c.sc_right, lag(1 1)orthogonal) ///
gmm(c.av_bon,     lag(3 3))              gmm(c.av_bon#c.sc_right,  lag(1 2)collapse) ///
gmm(c.sc_right,   lag(2 2)collapse) ///
gmm(c.lnav_gdp,   lag(2 4))              gmm(c.lnav_gdp#c.lnav_gdp,lag(2 4) ) ///  
iv(ln_techpc0 ln_trad0 ln_urb0 ln_sec0 ln_inds0)  ///
twostep small

margins, dydx(c.av_bon) at(sc_right=0.0561) 
margins, dydx(c.av_bon) at(sc_right=0.1666) 
margins, dydx(c.av_bon) at(sc_right=0.4366) 
margins, dydx(c.av_bon) at(sc_right=0.9444) 
margins, dydx(c.av_bon) at(sc_right=1) 

*lerner*
xtabond2 lnav_techpc c.fin_dev c.fin_dev#c.sc_right c.av_lern c.av_lern#c.sc_right c.sc_right ///
c.lnav_gdp c.lnav_gdp#c.lnav_gdp ln_techpc0 ln_trad0 ln_urb0 ln_sec0 ln_inds0, ///
gmm(c.fin_dev,    lag(1 2) )            gmm(c.fin_dev#c.sc_right, lag(1 1)orthogonal ) ///
gmm(c.av_lern,    lag(2 4) collapse )   gmm(c.av_lern#c.sc_right, lag(2 3)orthogonal) ///
gmm(c.sc_right,   lag(1 1) orthogonal) ///
gmm(c.lnav_gdp,   lag(2 2))  gmm(c.lnav_gdp#c.lnav_gdp,  lag(2 2)) ///  
iv(ln_techpc0 ln_trad0 ln_urb0 ln_sec0 ln_inds0) ///
twostep small

margins, dydx(c.av_lern) at(sc_right=0.0561) 
margins, dydx(c.av_lern) at(sc_right=0.1666) 
margins, dydx(c.av_lern) at(sc_right=0.4366) 
margins, dydx(c.av_lern) at(sc_right=0.9444) 
margins, dydx(c.av_lern) at(sc_right=1) 

*concerntration*
xtabond2 lnav_techpc c.fin_dev c.fin_dev#c.sc_right c.lnav_concn c.lnav_concn#c.sc_right c.sc_right ///
c.lnav_gdp c.lnav_gdp#c.lnav_gdp ln_techpc0 ln_trad0 ln_urb0 ln_sec0 ln_inds0, ///
gmm(c.fin_dev,    lag(1 1) collapse)    gmm(c.fin_dev#c.sc_right,    lag(1 2) ) ///
gmm(c.lnav_concn, lag(2 2) )            gmm(c.lnav_concn#c.sc_right, lag(1 3) collapse) ///
gmm(c.sc_right,   lag(1 1) collapse) ///
gmm(c.lnav_gdp,   lag(1 2) )    gmm(c.lnav_gdp#c.lnav_gdp,  lag(1 2) ) ///  
iv(ln_techpc0 ln_trad0 ln_urb0 ln_sec0 ln_inds0) ///
twostep small

margins, dydx(c.lnav_concn) at(sc_right=0.0561) 
margins, dydx(c.lnav_concn) at(sc_right=0.1666) 
margins, dydx(c.lnav_concn) at(sc_right=0.4366) 
margins, dydx(c.lnav_concn) at(sc_right=0.9444) 
margins, dydx(c.lnav_concn) at(sc_right=1) 


use "E:\隨身硬碟備份\E\TRY\findev_2017\Fin_Co2_pol_2018\submit\version3_202007\Program\n82_4y_fin_202005.dta",clear
tsset id period

*credit composition*
xtabond2 lnav_techpc c.lnav_borhh c.lnav_borhh#c.sc_right c.lnav_borfm c.lnav_borfm#c.sc_right c.sc_right ///
c.lnav_gdp c.lnav_gdp#c.lnav_gdp ln_techpc0 ln_trad0 ln_urb0 ln_sec0 ln_inds0, ///
gmm(c.lnav_borhh, lag(2 2) orthogonal)      gmm(c.lnav_borhh#c.sc_right, lag(1 2) orthogonal) ///
gmm(c.lnav_borfm, lag(2 2))                 gmm(c.lnav_borfm#c.sc_right, lag(2 2) collapse ) ///
gmm(c.sc_right,   lag(1 1) collapse) ///
gmm(c.lnav_gdp,   lag(1 2))                 gmm(c.lnav_gdp#c.lnav_gdp,   lag(1 1) ) ///  
iv(ln_techpc0 ln_trad0 ln_urb0 ln_sec0 ln_inds0) ///
twostep small

margins, dydx(c.lnav_borhh) at(sc_right=0.0561) 
margins, dydx(c.lnav_borhh) at(sc_right=0.1666) 
margins, dydx(c.lnav_borhh) at(sc_right=0.4366) 
margins, dydx(c.lnav_borhh) at(sc_right=0.9444) 
margins, dydx(c.lnav_borhh) at(sc_right=1) 

margins, dydx(c.lnav_borfm) at(sc_right=0.0561) 
margins, dydx(c.lnav_borfm) at(sc_right=0.1666) 
margins, dydx(c.lnav_borfm) at(sc_right=0.4366) 
margins, dydx(c.lnav_borfm) at(sc_right=0.9444) 
margins, dydx(c.lnav_borfm) at(sc_right=1) 

